import Vue from 'vue'
import Router from 'vue-router'

import login from '@/views/Login'
import register from '@/views/register'
import hotholders from '@/views/hotholders/index'
import userIndex from '@/views/userIndex/userIndex'
import about from '@/views/about/index'
import listNews from '@/views/listNews/index'

import showNews from '@/views/showNews/index'
import listVideo from '@/views/listVideo/index'
import listWorks from '@/views/listWorks/index'
import showWorks from '@/views/showWorks/index'
import guide from '@/views/guide/index'
import newindex from '@/views/newindex/newindex'


Vue.use(Router);


const  router = new Router({
//export default new Router({
    routes: [
        
        {
            path:'/',  //主页
            name: 'newindex',
            component: newindex,
            meta: { title:"华中版权交易平台"}
        },
        {
            path: '/login', // 登录页
            name: 'login',
            component: login,
            meta: { title:"登录"}
        },
        {
            path:'/register', //注册
            name:'register',
            component: register,
            meta: { title:"注册"}
        },
        // {
        //     path:'/test', //注册
        //     name:'test',
        //     component: test,
        //     meta: { title:"测试签章"}
        // },
        {
            //个人挂牌信息页
            path: '/userIndex',
            name: 'userIndex',
            component: userIndex,
            redirect: "/userIndex/myTrading", //重定向到子路由，设置我的挂牌为默认显示
            meta: { title:"个人主页"},
            children:[
                {
                    path:'addTrading', //新增挂牌
                    name:'addTrading',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/addTrading')
                },
                {
                    path:'myTrading',//我的挂牌
                    name:'myTrading',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myTrading')

                },
                {
                    path:'editTrading',//修改挂牌
                    name:'editTrading',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/editTrading')

                },
                {
                    path:'signTrading',//签订协议
                    name:'signTrading',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/signTrading')

                },
                {
                    path:'myDelist',//我的摘牌
                    name:'myDelist',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myDelist')
                },
                {
                    path:'pay',//我的摘牌
                    name:'pay',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/pay')
                },
                // {
                //     path:'addDelist',//添加摘牌申请
                //     name:'addDelist',
                //     meta:{guard:true},//需要登录
                //     component:() => import('@/views/userIndex/addDelist')
                // },
                {
                    path:'myContract',//我的合同
                    name:'myContract',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myContract')
                },
                {
                    path:'mybill',//我的合同
                    name:'mybill',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/mybill')
                },
                {
                    path:'myCollection',//我的收藏
                    name:'myCollection',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myCollection')
                },
                {
                    path:'myInvoice',//我的发票
                    name:'myInvoice',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myInvoice')
                },
                {
                    path:'myNews',//我的消息
                    name:'myNews',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/myNews')
                },
                {
                    path:'userInfoEdit', //账户设置
                    name:'userInfoEdit',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/userInfoEdit')
                },
                {
                    path:'delistApply',//摘牌申请
                    name:'delistApply',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/delistApply')
                },
                {
                    path:'editApply',//摘牌编辑
                    name:'editApply',
                    meta:{guard:true},//需要登录
                    component:() => import('@/views/userIndex/editApply')
                }
            ]
        },
        {
            path:'/hotholders',//热门人
            name:'hotholders',
            component:hotholders,
        },
        {
            path: '/about', //关于我们
            name: 'about',
            component: about,
        },
        {
            path:'/listNews', //行业资讯
            name:'listNews',
            component: listNews
        },
        {
            path:'/showNews', //行业资讯
            name:'showNews',
            component: showNews
        },
        {
            path:'/listVideo', //影视版权
            name:'listVideo',
            component: listVideo
        },
        {
            path:'/listWorks',//版权交易
            name:'listWorks',
            component: listWorks
        },
        {
            path:'/showWorks', //产品详情页
            name:'showWorks',
            component: showWorks
        },
        {
            path:'/guide', //交易指引
            name:'guide',
            component:guide
        }

    ]
});
　router.afterEach((to,from,next)=>{

    　　　　window,scrollTo(0,0)
    
    　　})
 
export default router   